﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HammerMUD.System;
using HammerMUD.Characters;
using HammerMUD.Rooms;

namespace HammerMUD.Commands
{
    public class SayCommand : Command
    {
        public SayCommand()
        {
            Name = "say";
            Help = "say <message>";
            SecurityLevel = HammerMUD.Admin.SecurityLevel.User;
        }

        public override void Do(User from, List<String> arguments)
        {
            if (arguments.Count > 1)
            {
                String message = String.Empty;
                arguments.RemoveAt(0);
                foreach(String s in arguments)
                {
                    message = message + s + " ";
                }

                RoomUtilities.SendToRoom(from, from.UserAccount.CurrentCharacter.Name + " says '" + message.Trim() + "'");
                
                from.Send("You say '" + message.Trim() + "'");
            }
            else
            {
                from.Send(Help);
            }
        }
    }
}
